package com.weizai.carshop.model.entiity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.weizai.carshop.model.config.LocalDateTimeConfig;
import com.weizai.carshop.model.dto.AddressInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@TableName("orders")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OrderDetailEntity {

    @TableId(type = IdType.AUTO)
    private Long id;

    private Long userId;

    private String sn;

    private Integer state;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private AddressInfo address;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private CartListEntity[] goodsDetail;

    @JsonSerialize(using = LocalDateTimeConfig.LocalDateTimeSerializer.class)
    private LocalDateTime createTime;

    @JsonSerialize(using = LocalDateTimeConfig.LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;
}
